package com.zf.shuashua.bean.advert;

import com.zf.shuashua.api.Store;

import java.io.Serializable;
import java.util.List;

/**
 * 开屏广告配置
 */
public class OpenConfigBean implements Serializable {

    //开屏
    private List<AdvertConfigBean> open;
    private int indexOpen = -1;

    /**
     * 顺序执行open信息流配置
     * @return
     */
    public AdvertConfigBean getOpenConfig(){
        if(open == null || open.size() < 1){
            return null;
        }
        if(open.size() == 1){
            return open.get(0);
        }
        int index = indexOpen + 1 < open.size() ? indexOpen + 1 : 0;
        indexOpen = index;
        Store.getInstance().setOpenIndex(index);
        return open.get(index);
    }

    public List<AdvertConfigBean> getOpen() {
        return open;
    }

    public void setOpen(List<AdvertConfigBean> open) {
        this.open = open;
    }

    public int getIndexOpen() {
        return indexOpen;
    }

    public void setIndexOpen(int indexOpen) {
        this.indexOpen = indexOpen;
    }
}
